package com.ruoyi.mp.service.impl;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.db.domain.web.MpClientSubCart;
import com.ruoyi.db.mapper.web.MpClientSubCartMapper;
import com.ruoyi.mp.service.IMpClientSubCartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

/**
 * 购物车详情Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-08-02
 */
@Service
@Transactional(rollbackOn = Exception.class)
public class MpClientSubCartServiceImpl implements IMpClientSubCartService
{
    @Autowired
    private MpClientSubCartMapper mpClientSubCartMapper;

    /**
     * 查询购物车详情
     * 
     * @param subCartId 购物车详情主键
     * @return 购物车详情
     */
    @Override
    public MpClientSubCart selectMpClientSubCartBySubCartId(Long subCartId)
    {
        return mpClientSubCartMapper.selectMpClientSubCartBySubCartId(subCartId);
    }

    /**
     * 查询购物车详情列表
     * 
     * @param mpClientSubCart 购物车详情
     * @return 购物车详情
     */
    @Override
    public List<MpClientSubCart> selectMpClientSubCartList(MpClientSubCart mpClientSubCart)
    {
        return mpClientSubCartMapper.selectMpClientSubCartList(mpClientSubCart);
    }

    /**
     * 新增购物车详情
     * 
     * @param mpClientSubCart 购物车详情
     * @return 结果
     */
    @Override
    public int insertMpClientSubCart(MpClientSubCart mpClientSubCart)
    {
        mpClientSubCart.setCreateTime(DateUtils.getNowDate());
        return mpClientSubCartMapper.insertMpClientSubCart(mpClientSubCart);
    }

    /**
     * 修改购物车详情
     * 
     * @param mpClientSubCart 购物车详情
     * @return 结果
     */
    @Override
    public int updateMpClientSubCart(MpClientSubCart mpClientSubCart)
    {
        return mpClientSubCartMapper.updateMpClientSubCart(mpClientSubCart);
    }

    /**
     * 批量删除购物车详情
     * 
     * @param subCartIds 需要删除的购物车详情主键
     * @return 结果
     */
    @Override
    public int deleteMpClientSubCartBySubCartIds(Long[] subCartIds)
    {
        return mpClientSubCartMapper.deleteMpClientSubCartBySubCartIds(subCartIds);
    }

    /**
     * 删除购物车详情信息
     * 
     * @param subCartId 购物车详情主键
     * @return 结果
     */
    @Override
    public int deleteMpClientSubCartBySubCartId(Long subCartId)
    {
        return mpClientSubCartMapper.deleteMpClientSubCartBySubCartId(subCartId);
    }
}
